<!-- 知识库 -->
<script lang="ts" setup>
import { Delete, Edit } from '@element-plus/icons-vue'
import { ref } from 'vue'
// 假数据
const knowledgeList = ref([
  {
    id: 5961,
    title: '前端开发规范',
    pub_date: '2022-07-10 14:53:52.604',
    state: '已发布',
    cate_name: '前端'
  },
  {
    id: 5962,
    title: 'vue3中的setup语法糖',
    pub_date: '2022-07-10 14:54:30.904',
    state: '草稿',
    cate_name: 'vue3'
  },
  {
    id: 5963,
    title: 'go语言中的slice函数',
    pub_date: '2022-07-10 14:55:09.504',
    state: '已发布',
    cate_name: 'go语言'
  },
  {
    id: 5964,
    title: 'go语言中的slice函数',
    pub_date: '2022-07-10 14:55:09.504',
    state: '草稿',
    cate_name: 'go语言'
  }
])
const currentPage = ref(4)
const pageSize = ref(3)
</script>

<template>
  <page-container title="知识分享">
    <template #extra>
      <el-button type="primary">添加知识分享</el-button>
    </template>
    <!-- 表单区域 -->
    <el-form inline>
      <el-form-item label="知识标题：" style="width: 300px">
        <el-select>
          <el-option label="前端开发规范" value="qianduan"></el-option>
          <el-option label="vue3中的setup语法糖" value="Vue"></el-option>
          <el-option label="go语言中的slice函数" value="go"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="知识分类：" style="width: 300px">
        <el-select>
          <el-option label="前端" value="qianduan"></el-option>
          <el-option label="后端" value="houduan"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="发布状态：" style="width: 300px">
        <el-select>
          <el-option label="已发布" value="已发布"></el-option>
          <el-option label="草稿" value="草稿"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary">搜索</el-button>
        <el-button>重置</el-button>
      </el-form-item>
    </el-form>
    <!-- 表格区域 -->
    <el-table :data="knowledgeList" style="width: 100%">
      <el-table-column label="知识标题" width="400">
        <template #default="{ row }">
          <el-link type="primary" :underline="false">{{ row.title }}</el-link>
        </template>
      </el-table-column>
      <el-table-column label="分类" prop="cate_name"></el-table-column>
      <el-table-column label="发布时间" prop="pub_date"> </el-table-column>
      <el-table-column label="状态" prop="state"></el-table-column>
      <el-table-column label="操作" width="100">
        <template>
          <!--  #default="{ row }" -->
          <el-button :icon="Edit" circle plain type="primary"></el-button>
          <el-button :icon="Delete" circle plain type="danger"></el-button>
        </template>
      </el-table-column>
      <template #empty>
        <el-empty description="没有数据" />
      </template>
    </el-table>
    <!-- 分页区域 -->
    <el-pagination
      v-model:current-page="currentPage"
      v-model:page-size="pageSize"
      :page-sizes="[2, 3, 4, 5, 10]"
      background
      layout="jumper, total, sizes, prev, pager, next"
      :total="10"
      style="margin-top: 20px; justify-content: flex-end"
    />
  </page-container>
</template>

<style lang="scss" scoped></style>
